<template>
  <section class="msite">
    <!--首页头部-->
    <HeaderTop :title="address.name">
      <router-link slot="search" to="/search" class="header_search">
        <i class="iconfont icon-sousuo"></i>
      </router-link>
      <router-link slot="login" :to="userInfo._id?'userInfo':'/login'" class="header_login">
        <span class="header_login_text" v-if="userInfo._id">
          <i class="iconfont icon-person"></i>
        </span>
        <span class="header_login_text" v-else>登录|注册</span>
      </router-link>
    </HeaderTop>
    <!--首页导航-->
    <MsiteNav />
    <!--首页附近商家-->
    <div class="msite_shop_list">
      <div class="shop_header">
        <i class="iconfont icon-xuanxiang"></i>
        <span class="shop_header_title">附近商家</span>
      </div>
      <ShopList />
    </div>
  </section>
</template>

<script>
import HeaderTop from "../../components/HeaderTop/HeaderTop";
import ShopList from "../../components/ShopList/ShopList";
import MsiteNav from "../../components/MsiteNav/MsiteNav";

import { mapState } from "vuex";
export default {
  props: {},
  data() {
    return {
      // mytitle: "昌平区北七家宏福科技园(337省道北)"
    };
  },
  computed: {
    ...mapState(["address","userInfo"]),
    
  },
  created() {},
  mounted() {
    console.log("xxx");

    this.$store.dispatch("getAddress");
    this.$store.dispatch("getCategorys");
    this.$store.dispatch("getShops");
  },
  watch: {},
  methods: {},
  components: {
    HeaderTop,
    ShopList,
    MsiteNav
  }
};
</script>

<style lang="stylus" rel="stylesheet/stylus">
@import '../../common/stylus/mixins.styl'
.msite // 首页
  width 100%
  .msite_shop_list
    top-border-1px(#e4e4e4)
    margin-top 10px
    background #fff
    .shop_header
      padding 10px 10px 0
      .shop_icon
        margin-left 5px
        color #999
      .shop_header_title
        color #999
        font-size 14px
        line-height 20px
</style>
